Skip to content

Document diagnostic markup alternatives to WithSpan in roslyn-analyzers skill - #6552

Open
AArnott wants to merge 3 commits into
github:mainfrom
AArnott:aarnott-roslyn-skill-diagnostic-markers
Open

AArnott wants to merge 3 commits into
github:mainfrom
AArnott:aarnott-roslyn-skill-diagnostic-markers

Conversation

@AArnott

@AArnott AArnott commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Pull Request Checklist

  • I have read and followed the CONTRIBUTING.md guidelines.
  • I have read and followed the Guidance for submissions involving paid services.
  • My contribution adds a new instruction, prompt, agent, skill, workflow, or canvas extension file in the correct directory.
  • The file follows the required naming convention.
  • The content is clearly structured and follows the example format.
  • I have tested my instructions, prompt, agent, skill, workflow, or canvas extension with GitHub Copilot.
  • I have run npm start and verified that README.md is up to date.
  • I am targeting the main branch for this pull request.

Description

The roslyn-analyzers skill only showed [|...|] markup and called WithSpan a last resort. This documents the other markup forms so tests avoid hard-coded positions: {|DiagnosticId:code|} (ID in the markup, no DiagnosticResult needed) and {|#n:code|} paired with DiagnosticResult.WithLocation(n) when arguments, severity, or additional locations must be asserted. It also lists the relevant DiagnosticResult members and says to avoid WithSpan and WithLocation(line, column).


Type of Contribution

  • Update to existing instruction, prompt, agent, plugin, skill, workflow, or canvas extension.

Additional Notes

Docs-only change to skills/roslyn-analyzers/SKILL.md.

Validation: I applied the guidance to a real analyzer test in AArnott/Nerdbank.MessagePack (DefaultValueInitializerAnalyzerTests.NonConstantInitializerHasNoCodeFix), replacing WithSpan(6, 13, 6, 21) with a {|#0:Computed|} marker plus VerifyCS.Diagnostic().WithLocation(0).WithArguments("Computed"). It passes with TUnit on net10.0. {|NBMsgPack110:...|} markers are already used throughout that suite. I also confirmed that WithLocation(int) works for markers in an additional TestState.Sources file, and that an indexed marker without a matching DiagnosticResult fails (documented in the skill).


By submitting this pull request, I confirm that my contribution abides by the Code of Conduct and will be licensed under the MIT License.

…rs skill

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@AArnott
AArnott requested a review from a team as a code owner November 20, 2026 21:04
Copilot AI adaptive review requested due to automatic review settings November 20, 2026 21:04
@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

🚦 Submission status: 👀 Ready for review

Risk tier: merge-risk:low — Documentation, metadata, generated output, or a small update to an existing resource
Required to merge: passing submission-gate checks plus 1 approval from reviewers with write access.

Why this tier
  • Small update (36 changed lines) to existing resources with no added or removed files

Automated checks

Check Status Details
Line endings ✅ Passed Passed · logs
Spelling ✅ Passed Passed · logs
Generated README consistency ✅ Passed Passed · logs
Skill validation ✅ Passed Passed · logs
Skill lint (vally) ✅ Passed Passed · logs
Risk scan ✅ Passed Passed · logs
Contributor reputation ✅ Passed Passed · logs
Duplicate resource scan ✅ Passed Passed · logs
PR quality signal ⏭️ Skipped Skipped by its workflow · logs

Review

  • Approvals: 0/1
  • Assigned reviewer: not assigned yet — comment /request-review to ask for one
  • Review target date: not set
  • Still needed: 1 more approval(s)
  • No staffed reviewer pool owns these files yet; any reviewer with write access counts as the resource owner.

Commands

Command Who What it does
/rerun-checks PR author, maintainers Re-runs failed or incomplete checks and re-evaluates this gate
/request-review PR author, maintainers Asks the review rotation to assign a reviewer (adds needs-reviewer)

Updated for 2570bd8 · gate run · This comment is maintained automatically — see submission gate docs.

@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

🟡 Contributor Reputation Check: MEDIUM risk

Check Risk
Profile MEDIUM
Credential audit NONE

Maintainers: please review this contributor before merging.
See the workflow run for full details.
Automated check powered by AGT.

@github-actions

Copy link
Copy Markdown
Contributor

🔒 PR Risk Scan Results

Scanned 1 changed file(s).

Severity Count
🔴 High 0
🟠 Medium 0
ℹ️ Info 0

✅ No matching risk patterns were detected in changed files.

This is an automated soft-gate report. Findings indicate review targets and do not block merge by themselves.

@github-actions github-actions Bot added the skill-check-error Skill validator reported errors label Nov 20, 2026
@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

🔍 Vally Lint Results

⛔ Findings need attention

Scope Checked
Skills 1
Agents 0
Total 1
Severity Count
❌ Errors 1
⚠️ Warnings 0
ℹ️ Advisories 0

Summary

Level Finding
❌ roslyn-analyzers (1/2 checks passed, 1 failed)
Full linter output
### Linting skills/roslyn-analyzers
❌ roslyn-analyzers (1/2 checks passed, 1 failed)
    ✗ [spec-compliance] 1 of 1 skill(s) have spec violations.
        ✗ spec-compliance: Spec checks failed.
            ✗ File length (514 lines) exceeds limit (500).
    ✓ [valid-refs] All file references across 1 skill(s) are valid.
        ✓ valid-refs: All file references resolve to existing files within the skill directory.

1 skill(s) linted, 1 failed

Note: Vally lint returned a non-zero exit code. Please review the findings above before merge.

@github-actions github-actions Bot added ready-for-review Submission passed intake validation and is ready for maintainer review and removed awaiting-automation labels Nov 20, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The guidance includes a non-compiling DiagnosticResult.WithLocation overload and lacks a real analyzer-test example verifying the documented assertions.

2 open issues
What changed in this PR

This pull request expands the roslyn-analyzers skill with guidance on using diagnostic markup and DiagnosticResult assertions instead of hard-coded source positions.

Changes:

  • Documents [|...|], {|DiagnosticId:...|}, and indexed {|#n:...|} markup forms.
  • Adds examples for diagnostic assertions and message-argument checks.
  • Lists relevant DiagnosticResult members and discourages hard-coded spans and line/column locations.
File Description
skills/​roslyn-analyzers/​SKILL.md Expands Roslyn analyzer test guidance with diagnostic markup patterns, DiagnosticResult usage, and recommendations for avoiding hard-coded locations.

Review effort: Lite (adaptive)

Comment thread skills/roslyn-analyzers/SKILL.md Resolved
Comment thread skills/roslyn-analyzers/SKILL.md Resolved
…yzers skill

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI adaptive review requested due to automatic review settings November 21, 2026 03:34
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The documentation still conflates WithOptions(...) with diagnostic assertions, so it should clarify that validation options such as IgnoreSeverity and IgnoreAdditionalLocations can disable checks and must be used deliberately.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Low severity Describe WithOptions as a validation option

skills/​roslyn-analyzers/​SKILL.md:451

WithOptions(...) does not assert a diagnostic detail; it controls validation behavior, including whether fields such as severity or additional locations are ignored. Grouping it with the assertion methods can lead readers to believe it verifies those fields, when it can instead disable their checks. Please describe it separately as a verifier/validation option and call out that options such as IgnoreSeverity and IgnoreAdditionalLocations should be used deliberately.

2 resolved since last review

Review effort: Lite (adaptive)

Copilot AI adaptive review requested due to automatic review settings November 21, 2026 03:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

An active documentation issue remains because the guidance inaccurately claims unmatched indexed markers necessarily fail, rather than requiring each validation marker to be paired with WithLocation(n).

1 open issue

Review effort: Lite (adaptive)

Relevant `DiagnosticResult` members:

- `WithLocation(int markupKey)`: binds to the `{|#n:...|}` span. Calling it again on the same result adds additional locations (for example related symbols), in order.
- Every `{|#n:...|}` marker must be matched by a `DiagnosticResult` using `WithLocation(n)`; an unmatched indexed marker fails with a diagnostic-count mismatch. When a code fix test's `fixedSource` still contains the diagnostic, add the same result to `FixedState.ExpectedDiagnostics`.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk:low needs-review:MEDIUM Contributor reputation check flagged MEDIUM risk ready-for-review Submission passed intake validation and is ready for maintainer review skill-check-error Skill validator reported errors skills PR touches skills

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants